package acwing._2LanQiao._4Enumerate;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @Project : ProgrammingExercises
 * @Package : ACWing._2LanQiao._4Enumerate
 * @File : Q1236.java
 * @Author : WangRuoyu
 * @Date : 2023/3/15 15:55
 */

public class Q1236 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] words = br.readLine().split(" ");

        int n = Integer.parseInt(words[0]);

        int[] a = new int[n];
        int[] b = new int[n];
        int[] c = new int[n];

        words = br.readLine().split(" ");
        for (int i = 0; i < n; ++i) {
            a[i] = Integer.parseInt(words[i]);
        }
        words = br.readLine().split(" ");
        for (int i = 0; i < n; ++i) {
            b[i] = Integer.parseInt(words[i]);
        }
        words = br.readLine().split(" ");
        for (int i = 0; i < n; ++i) {
            c[i] = Integer.parseInt(words[i]);
        }

        int[] cnta = new int[100010];
        int[] cntc = new int[100010];

        int max = -1;

        for (int i = 0; i < n; ++i) {
            cnta[a[i] + 1]++;
            cntc[c[i] + 1]++;
            max = Math.max(max, a[i]);
            max = Math.max(max, c[i]);
        }
        for (int i = 1; i <= max + 1; ++i) {
            cnta[i] += cnta[i - 1];
            cntc[i] += cntc[i - 1];
        }

        long res = 0;
        for (int bi : b) {
            if (max > bi) {
                res += (long) (cnta[bi] - cnta[0]) * (long) (cntc[max + 1] - cntc[bi + 1]);
            }
        }

        System.out.println(res);
    }
}


